from rest_framework import serializers
from goods.models import GoodsVisitCount


class GoodsVisitCountSerializer(serializers.ModelSerializer):
    """统计分类商品访问量模型类 序列化器"""

    # 指定返回分类名称
    category = serializers.StringRelatedField(label="商品分类", read_only=True)

    class Meta:
        model = GoodsVisitCount
        fields = ("category", "count")
